Skip to content

Conversation

@jwrosewell
Copy link
Collaborator

Added new self contained directory named ./paf-mvp-pattern-library-audit for V2 audit log HTML pattern library in Storybook.
Minor change to audit UI model.

@jwrosewell jwrosewell requested a review from a team as a code owner June 6, 2022 13:35
…can now be version controlled with each other.

The CMP figma can also be added into a sibling folder called "CMP".
@OlivierChirouze
Copy link
Contributor

OlivierChirouze commented Jun 13, 2022

Why is there an empty paf-mvp-pattern-library-audit/javascript/ok-ui.js file? Shouldn't it be removed?

Copy link
Contributor

@OlivierChirouze OlivierChirouze left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of issues that prevent me from approving:

  • disturbing figma directory
  • usage of Javascript instead of Typescript
  • empty ok-ui.js file


## About the authors

[Dot Creative](https://dotcreative.hu) is a Digital Agency. Our main profile is
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused about this whole directory: what is its purpose? why a documentation directory in this implementation repo? I'm not sure why there is such a need for such README, but if there is, I think it should be in (https://github.com/prebid/addressability-framework)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The .fig file is the one that contains all the design work which is the input into the pattern library. For those working on the design this file is important to be able to apply updates and understand the work. It is not relevant to developers working on code, but is relevant for the overall project. It could be moved to addressability-framework if that is the better repository. Please let me know once you've considered the .fig file.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think this would be better placed in the other repository, because it is focused on specs and design, while this one is focused on implementation.
WDYT?

import Details from './Details';
import { BlockedImage } from './Icons';

const Image = (args = {}) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pattern library is produced to be final implementation agnostic. These will be moved to typescript when the HTML and CSS is transferred for the reference implementation. Other optimisations will also be applied to reduce duplications, etc. The advantage of the approach is that someone could take this HTML and JS and deploy it in PHP (or another language) without any issues.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.
I'm sorry, I don't understand this sentence:

These will be moved to typescript when the HTML and CSS is transferred for the reference implementation

Could you please develop? What do you mean by "transferred for the reference implementation"?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My understanding is that it's pretty common to define components and stories in typescript, isn't it?
https://storybook.js.org/docs/react/get-started/whats-a-story

import Details from './Details';
import { BlockedImage } from './Icons';

const Image = (args = {}) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.
I'm sorry, I don't understand this sentence:

These will be moved to typescript when the HTML and CSS is transferred for the reference implementation

Could you please develop? What do you mean by "transferred for the reference implementation"?


## About the authors

[Dot Creative](https://dotcreative.hu) is a Digital Agency. Our main profile is
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think this would be better placed in the other repository, because it is focused on specs and design, while this one is focused on implementation.
WDYT?

Copy link
Contributor

@OlivierChirouze OlivierChirouze left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still waiting for more details on the JS versus TS.

@jwrosewell
Copy link
Collaborator Author

PR for the UI design element is now here.

@jwrosewell
Copy link
Collaborator Author

jwrosewell commented Jun 15, 2022

Still waiting for more details on the JS versus TS.

The HTML Pattern Library from Storybook is designed to be implemented in any environment and might not include Typescript. For example a PHP server serving static HTML and JS only. The Typescript conversion for this concrete implementation is done, if warranted, when the pattern library is used in the Typescript module. See the use of Popper in the CMP module.

@OlivierChirouze
Copy link
Contributor

Let me rephrase with some more basic English 😅
You want these components to be reusable in a different context, for example on a static website that only uses plain JS. For this reason, you want to stick to Vanilla JS for defining the components and stories, instead of TS.

If that's a correct interpretation, then I get your point, although:

  • I believe at least stories could be written in typescript as they are not part of the production code
  • reading docs on Storybook, it seems it is pretty standard to write components in tsx. Wouldn't be easy to have a build script that generates js files, if needed for a "vanilla JS" project?

Finally, this is nit picking but I think the components should be stored in a different directory than the stories, or at least the parent one should not be called "stories" as this can be misleading (at least I was confused).

@jwrosewell
Copy link
Collaborator Author

As with many things there are different ways of doing the same thing. In this case we've used JS in the Storybook pattern libraries. Happy for others to refactor to TS in the future if they wish.

"core-js": "^3.21.0",
"css-loader": "^5.2.7",
"sass": "^1.49.9",
"sass-loader": "^10.1.1",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to install @mdx-js/react to be able to start Storybook.
Isn't missing from the dependencies?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, NIT but the package-lock.json file seems to have been generated with a version of node that is too old: it should be in version 2 for node 17 (which is the version used on the repo, see .nvmrc)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re: Package - We've not had to install additional packages. I guess there is no harm in adding it but I can't recreate the issue.
Re: Version - We tend not to use the odd versions of Node because they aren’t the stable releases. We’ve opted for v16 as although v18 was recently released it doesn’t appear to be immediately compatible with our version of Storybook.

@jwrosewell
Copy link
Collaborator Author

Re: "Transfer to the reference implementation"
I meant that the pattern library provides the CSS and HTML which is then incorporated by the developer into the reference implementation of the module under the ./src/HTML and ./src/CSS folders. Sometimes parts need to be modified or changed to support the locale language object, the visibility of items, or removing duplication. Once they are there the rollup bundles them as template strings into the final assembly. I can cover via a conversation if that will help.

Copy link
Contributor

@OlivierChirouze OlivierChirouze left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving after our sync last week.

Please note that we consider the migration of Storybook components and stories from Javascript to Typescript is a must-have, but should be done in another PR.

@OlivierChirouze OlivierChirouze merged commit 20e5ba7 into OneKey-Network:main Jun 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants